-
Couldn't load subscription status.
- Fork 101
feat(backend): add filtering incoming payments by initiatedBy #3714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🚀 Performance Test ResultsTest Configuration:
Test Metrics:
📜 Logs |
| if ( | ||
| [IncomingPaymentState.Pending, IncomingPaymentState.Expired].includes( | ||
| payment.state | ||
| ) | ||
| ) { | ||
| return BigInt(0) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include the received amount regardless of the incoming payment state
| return payment | ||
| } | ||
|
|
||
| async function getPage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have the getWalletAddressPage use this function also, just need to add in the wallet address filter in the options
| "Specify the sort order of incoming payments based on their creation date, either ascending or descending." | ||
| sortOrder: SortOrder | ||
| "Filter incoming payments based on specific criteria such as initiation reason." | ||
| filter: IncomingPaymentFilter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add this filter to the walletAddress.incomingPayments resolver (since that is the resolver we will be using for the POS service API)
| function validateReceiveAmount( | ||
| deps: ServiceDependencies, | ||
| payment: IncomingPayment, | ||
| sentAmount: bigint | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| sentAmount: bigint | undefined | |
| receivedAmount: bigint | undefined |
| const { sortOrder, filter, ...pagination } = args | ||
| const order = sortOrder === 'ASC' ? SortOrder.Asc : SortOrder.Desc | ||
| const incomingPayments = await incomingPaymentService.getWalletAddressPage({ | ||
| const incomingPayments = await incomingPaymentService.getPage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used getPage to be able to use the filter
| if (walletAddressId) { | ||
| query.where('walletAddressId', walletAddressId) | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added client and walletAddressId so that getWalletAddressPage can use getPage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, a few comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final comment
| getPage: (pagination_: Pagination, sortOrder_?: SortOrder) => | ||
| getPageFn(pagination_, sortOrder_), | ||
| page: incomingPayments, | ||
| sortOrder: order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add filter in this as well, otherwise the payment results won't match the page info results
Changes proposed in this pull request
initiatedByContext
Fixes #3648 | RAF-1165
Checklist
fixes #numberuser-docslabel (if necessary)